﻿using Dapper;
using Manager.Database;
using Manager.Model;


namespace Manager.Service
{
    public class UserServiceByDapper
    {
         private readonly DapperContext _context;
        public UserServiceByDapper(DapperContext context)
        {
            _context = context;
        }


        public async Task<IEnumerable<User>> GetAllUsers()
        {
            const string sql = "select * from users";
            using (var connection = _context.GetConnection())
            {
                return await connection.QueryAsync<User>(sql);
            }

        }
    }
}
